# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=py3-certauth
pkgver=1.3.0
pkgrel=0
pkgdesc="Simple CertificateAuthority and host certificate creation, useful for man-in-the-middle HTTPS proxy"
url="https://github.com/ikreymer/certauth"
arch="noarch"
license="MIT"
depends="python3 py3-openssl py3-tldextract"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest py3-pytest-cov"
subpackages="$pkgname-pyc"
source="py3-certauth-$pkgver.tar.gz::https://files.pythonhosted.org/packages/source/c/certauth/certauth-$pkgver.tar.gz"
builddir="$srcdir/certauth-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl

	# testfile is good on github, but has unnesesary '\n' on pypi.org
	.testenv/bin/python3 -m pytest --cov certauth -v test/ \
		-k 'not test_file_ipv6_wildcard_ignore'
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
03a483461c90ae4b91ca60e0240a67f5b9ea50642c589d83c762b168095b137a0d9726ce24e0c1fe4eb91d7dd064e42755107b5fdf60be1addaa4b7e166dc01e  py3-certauth-1.3.0.tar.gz
"
